package cn.edu.neusoft.myappos.Activity;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

import cn.edu.neusoft.myappos.Adapter.UserAdapter;
import cn.edu.neusoft.myappos.Bean.UserBean;
import cn.edu.neusoft.myappos.R;

public class MainUserZoneActivity extends AppCompatActivity {
    private RecyclerView recyclerView;
    private RecyclerView.LayoutManager layoutManager;
    private UserAdapter Adapter;
    List<UserBean> list;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.userzone);
        initRecyclerView();
    }

    private void initRecyclerView() {
        recyclerView =findViewById(R.id.userrv);
        layoutManager=new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setHasFixedSize(true);
        list=getData();
        Adapter=new UserAdapter(this);
        recyclerView.setAdapter(Adapter);
        Adapter.setList(list);
    }

    public List<UserBean> getData(){
        List<UserBean>list=new ArrayList<UserBean>();
        UserBean userBean;

        userBean =new UserBean();
        userBean.setId(1);
        userBean.setName("琦琦");
        userBean.setPic(R.drawable.f2);
        userBean.setPos("学生");
        userBean.setYear("1");
        list.add(userBean);

        userBean =new UserBean();
        userBean.setId(2);
        userBean.setName("杰西");
        userBean.setPic(R.drawable.f2);
        userBean.setPos("学生");
        userBean.setYear("1");
        list.add(userBean);

        userBean =new UserBean();
        userBean.setId(3);
        userBean.setName("梅森");
        userBean.setPic(R.drawable.f2);
        userBean.setPos("学生");
        userBean.setYear("2");
        list.add(userBean);

        userBean =new UserBean();
        userBean.setId(4);
        userBean.setName("尤尤");
        userBean.setPic(R.drawable.f2);
        userBean.setPos("老师");
        userBean.setYear("1");
        list.add(userBean);

        userBean =new UserBean();
        userBean.setId(1);
        userBean.setName("彩虹");
        userBean.setPic(R.drawable.f2);
        userBean.setPos("老师");
        userBean.setYear("3");
        list.add(userBean);

        userBean =new UserBean();
        userBean.setId(1);
        userBean.setName("艾力克斯");
        userBean.setPic(R.drawable.f2);
        userBean.setPos("学生");
        userBean.setYear("1");
        list.add(userBean);

        userBean =new UserBean();
        userBean.setId(1);
        userBean.setName("菩提");
        userBean.setPic(R.drawable.f2);
        userBean.setPos("管理员");
        userBean.setYear("3");
        list.add(userBean);


        return list;
    }
}
